<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>新增角色</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../../../bangnuo/admin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../bangnuo/admin/style/admin.css" media="all">
</head>

<body>
<div class="layui-fluid">
    <div class="layui-card" id="layuiadmin-form-useradmin" style="padding: 20px 0 0 0;">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label"></label>
                    <div class="layui-input-block">
                        <input type="hidden" name="roleUuid" placeholder="不可输入" autocomplete="off" class="layui-input" readonly="readonly"
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">角色名</label>
                    <div class="layui-input-block">
                        <input type="text" name="roleName" placeholder="请输入" autocomplete="off" class="layui-input">
                        <input type="hidden" name="id" id="id" placeholder="不可输入" autocomplete="off" class="layui-input" readonly="readonly"
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">唯一标识</label>
                    <div class="layui-input-block">
                        <input type="text" name="roleCode" placeholder="请输入" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <br/>
                <br/>
                <div class="layui-form-item">
                    <div class="layui-input-block" style="padding-bottom: 10px; margin-left: 110px; margin-right: -110px;">
                        <button class="layui-btn" lay-submit lay-filter="formDemo" data-type="close">立即提交</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript" src="../../../bangnuo/admin/layui/layui.js"></script>
<script type="text/javascript" src="../../../bangnuo/admin/js/jquery-1.8.0.min.js"></script>
<script type="text/javascript">
    layui.use('form', function () {
        var form = layui.form;

        //监听提交
        form.on('submit(formDemo)', function (data) {
            layer.msg(JSON.stringify(data.field));
            $.ajax({
                type: "post",
                contentType: "application/json;charset=UTF-8",
                url: "/permissionsEntity/addRole",
                async: true,
                data: JSON.stringify(data.field),
                success: function (data) {
                    layer.msg(data.message);
                }
            });
            return false;
        });
    });
</script>
<!--关闭弹层-->
<script>
    layui.use('layer', function () {
        var $ = layui.$,
            layer = layui.layer,
            index = parent.layer.getFrameIndex(window.name); //获取窗口索引
        var active = {
            close: function () {
                var id = '#LAY_layer_iframe_demo',
                    mark = $('#LAY_mark');
                parent.layer.msg('添加成功');
                parent.layer.tips('Look here', id, {
                    time: 5000
                });
                parent.layer.close(index);
            }
        }
        $('.layui-input-block .layui-btn').on('click', function () {
            var othis = $(this),
                type = othis.data('type');
            active[type] && active[type].call(this);
        });
    });
</script>
</body>
</html>